package cn.jbolt.ai.core.chain.node.output.toclient;

import cn.jbolt.ai.core.chain.node.base.RenderType;
import cn.jbolt.util.JSONUtil;
import com.fasterxml.jackson.databind.JsonNode;

public class OutputToClientConfig {

    /**
     * 输入字段
     */
    private String inputField;


    /**
     * 输出模板
     */
    private String inputTpl;

    private RenderType renderType = RenderType.markdown;

    private String format = "markdown";

    /**
     * 消息是否持久化到数据库
     */
    private boolean persistDb = false;

    public static OutputToClientConfig from(JsonNode jsonNode) {
        if (jsonNode == null) {
            return new OutputToClientConfig();
        }
        return JSONUtil.toObject(jsonNode, OutputToClientConfig.class);
    }


    public String getInputField() {
        return inputField;
    }

    public void setInputField(String inputField) {
        this.inputField = inputField;
    }

    public String getInputTpl() {
        return inputTpl;
    }

    public void setInputTpl(String inputTpl) {
        this.inputTpl = inputTpl;
    }

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }

    public boolean isPersistDb() {
        return persistDb;
    }

    public void setPersistDb(boolean persistDb) {
        this.persistDb = persistDb;
    }

    public RenderType getRenderType() {
        return renderType;
    }

    public void setRenderType(RenderType renderType) {
        this.renderType = renderType;
    }
}
